From: Jasper St. Pierre Date: Tue, 3 Dec 2013 22:54:02 +0000 (-0500) Subject: background: Don't silently fizzle out when removing bad content from the cache X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3016 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7249b118993474b7e6358f82e872d7735154e796;p=gnome-shell.git background: Don't silently fizzle out when removing bad content from the cache If the background is already removed, or we're trying to remove bad content, this is probably a bug in content accounting, so let us crash so we can fix the bugs. https://bugzilla.gnome.org/show_bug.cgi?id=719803 --- diff --git a/js/ui/background.js b/js/ui/background.js index 885e96ba6..a56a0af8b 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -113,9 +113,9 @@ const BackgroundCache = new Lang.Class({ _removeContent: function(contentList, content) { let index = contentList.indexOf(content); - - if (index >= 0) - contentList.splice(index, 1); + if (index < 0) + throw new Error("Trying to remove invalid content: " + content); + contentList.splice(index, 1); }, removePatternContent: function(content) {